/*
 * Account.java
 *
 */

package com.javacore.day3.withdrawal;

import java.util.Scanner;

/**
 *
 * @author
 */
public class Account {
    
    /** Creates a new instance of Account */
    public Account() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        // Declaring and initializing the variables
        double accountBalance = 10000.00;
        double withdraw = 0.00;
        boolean possible = false;        
        
        // Accepting user input and storing it in variables
        System.out.printf("Available account balance: $%.2f \n" , accountBalance);
        System.out.println("Enter the Amount to withdraw: $");
        Scanner scan = new Scanner(System.in);
        withdraw = scan.nextDouble();
        
        /* Decision making whether sufficient balance is present for
           transaction to proceed. */
        possible = (accountBalance > withdraw);
        accountBalance = possible ? accountBalance - withdraw : accountBalance ;
        System.out.printf("\nCurrent account balance: $%.2f" , accountBalance);
        System.out.println("\nTransaction Successful: " + possible);

    }
}